package com.example.travelgd.repository;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.travelgd.entity.Food;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface FoodMapper extends BaseMapper<Food> {
    List<Food> selectAllEnabled();

    List<Food> selectByCategory(Integer categoryId);

    List<Food> selectByCategoryWithPage(@Param("categoryId") Integer categoryId,
                                        @Param("offset") Integer offset,
                                        @Param("pageSize") Integer pageSize);

    List<Food> selectAllEnabledWithPage(@Param("offset") Integer offset,
                                        @Param("pageSize") Integer pageSize);

    // 新增：获取所有分类ID
    List<Integer> getAllCategories();

    // 新增：获取分类下的食物数量
    Integer countByCategory(@Param("categoryId") Integer categoryId);

    // 新增：获取所有启用状态的食物数量
    Integer countAllEnabled();
}